#在Python中，2 / 3 => 0.66666 而不是 0 （跟C++不同，不会舍去小数）
# print(2 / 3)

# avg = (3.14 + 4.5 + 6 + 8.4) / 4
# total = (3.14 - avg) ** 2 + (4.5 - avg) ** 2 + (6 - avg) ** 2 + (8.4 - avg) ** 2
# result = total / 3
# print(result)

# a = 1; print(type(a))
# b = 3.14; print(type(b))
# c = 'hello'; print(type(c)); print(len(c))
# d = 'he say: "I am so happy"'; print(d)
# e = '''haha'''; print(len(e))
# f = True; print(type(f))

# a: int = 1
# print(type(a))
# a: str = 'hello'
# print(type(a))
# a:float = 3.14
# print(type(a))

# string = 'haha'
# print(type(string))
# print(f'string is {string}')
# string = f"string is {string}"1
# print(type(string))

# print(int(input('请输入一个整数:')))

# a = int(3.14)
# print(a)
# b = int(True)
# print(b)
# c = int(3.14)
# print(c)
# d = int('1010', 2) #2进制转换10进制
# print(d)
# e = int('1010')
# print(e)

# a = float(input('请输入第1个小数：'))
# b = float(input('请输入第2个小数：'))
# c = float(input('请输入第3个小数：'))
# d = float(input('请输入第4个小数：'))
# print((a + b + c + d) / 4)

# print(4 ** 3) #4的三次方
# print(4 ** 0.5) #4的开方

# print(7 // 2) #3
# print(-7 // 2) #-4

# print(0.1 + 0.2)#浮点数在计算机中存储可能不精确
# print(0.3 == 0.1 + 0.2)#同上

# print(0.1 < 0.2 < 0.3)
# print(0.1 < 0.2 and 0.2 < 0.3)#and ->并且
# print(0.1 > 0.2 or 0.2 < 0.3)#or->或者
# print(not 0.1 < 0.2)#not->取反
# print(not 0.1 > 0.2)
# print(0.1 < 0.2 or 1 / 0)#短路求职

# a, b = 1, 3.2#多元赋值
# print(a, b)

# #交换两个变量
# a = 1; b = 2
# tmp = a; a = b; b = tmp
# print(a, b)
#
# a, b = b, a
# print(a, b)

# ch = input('请输入你的选择(a/b/c):')
# if ch == 'a':
#     print('大熊熊')
# elif ch == 'b':
#     print('冬冬')
# elif ch == 'c':
#     print("嘟嘟")
# else:
#     print('选择有误')

# year = int(input('请输入一个年份：'))
# if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
#     print('闰年')
# else:
#     print('平年')

# if year % 100 == 0:
#     #世纪闰年
#     if year % 400 == 0:
#         print('闰年')
#     else:
#         print('平年')
# else:
#     #普通闰年
#     if year % 4 == 0:
#         print('闰年')
#     else:
#         print('平年')

# a = int(input('请输入一个整数：'))
# if a != 1:
#     pass
# else:
#     print(a)

#求1！ + 2！ + 3！ + 4！
# n = 1
# total = 0
# while n <= 4:
#     #求n的阶层
#     i = 1
#     fac = 1
#     while i <= n:
#         fac *= i
#         i += 1
#     total += fac
#     n += 1
# print(f'1! + 2! + 3! + 4! = {total}')

#求1！ + 2！ + 3！ + 4！
# n = 1
# total = 0
# fac = 1
# while n <= 4:
#     fac *= n
#     total += fac
#     n += 1
# print(f'1! + 2! + 3! + 4! = {total}')

# for i in range(1, 11):
#     print(i)

# for i in range(1, 11, 2):
#     print(i)

# for i in range(11, 1, -1):
#     print(i)



# result = 0
# cnt = 0
# while True:
#     n = input('请输入一个整数：')
#     if n == ';':
#         break
#     else:
#         n = int(n)
#         result += n
#         cnt += 1
# print(f'平均数为{result / cnt}')

#Python的取余操作遵循结果的符号与除数相同的原则：
print(-19 % 2)    # 输出: 1
print(-19 % -2)   # 输出: -1
print(19 % -2)    # 输出: -1